﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;

public partial class aspnet_admin_bock_Create_CX_DataBaseBackUP : System.Web.UI.Page
{
    /// <summary>
    /// 数据操作通用类
    /// </summary>
    TongUse TextData = new TongUse();
    protected void Page_Load(object sender, EventArgs e)
    {
        Bdir.Text = AppDomain.CurrentDomain.BaseDirectory;
    }
    //添加数据库的命名
    protected void Button1_Click(object sender, EventArgs e)
    {
        string path = Bdir.Text.Trim();

        //如果没有找到盘符
        if (path.IndexOf(":") == -1)
        {
            TextData.DirCreate(Server.MapPath("/" + Bdir.Text.Trim() + "/"));
            path = Server.MapPath("/" + Bdir.Text.Trim() + "/");
        }
        string sql = "BACKUP DATABASE \"" + BdataBaseNmae.Text.Trim() + "\" TO DISK = '" + path + BakName.Text.Trim() + "' with init ";
        //Response.Write(sql);
        TextData.SqlDataSave(sql);//备份成功
        tt.Text = "备份成功";
    }
}
